package com.bee.plus.store;

import com.bee.plus.store.service.StoreChatService;
import com.bee.plus.vo.DbTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

/**
 * @author xupei
 */
@Component
public class StoreManger {

    @Value("${ai.store.dbType}")
    public  String dbType;


    @Autowired
    @Qualifier("localChatService")
    private StoreChatService localChatService;

    public static Map<String,StoreChatService> dbTypesMap=new HashMap<String,StoreChatService>();


    @PostConstruct
    private void load(){
        dbTypesMap.put(DbTypeEnum.Local.getValue(),localChatService);
        dbTypesMap.put(DbTypeEnum.Redis.getValue(),localChatService);
    }

    public StoreChatService getDb(){
       return dbTypesMap.get(dbType);
    }
}
